﻿
<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>小红书敏感词违禁检测工具_在线查询-K3达人社</title>
    <meta name="description" content="小红书B站违禁敏感词在线检测查询工具,适合广告文案查询，快速易用，博主KOL专业撰写辅助工具" />
    <meta name="keywords" content="K3达人社,小红书违禁词在线检测,小红书违禁词,违禁词查询,敏感词检测工具,违禁词在线查询" />
    <script type="text/javascript">var menuId = "0_2";</script>
    <link rel='stylesheet' type='text/css' href='/static/css/layerui.css' />
    <script type="text/javascript" src="/static/js/referrer.js?v=11"></script>
    <script type="text/javascript" src="/static/js/layer/layer.js"></script>
    <script type="text/javascript" src="/static/js/number.js"></script>

</head>
<body>
    <script type="text/javascript" src="/static/js/top.js?v=11"></script>

    <div class="layout" id="wordContainer">
        <div class="line-big">
            <div class="x12 text-center">
                <h2 class="full-screen-en-title hidden">在线查询违禁词</h2>
                <p class="text-big banned-title">小红书B站违禁词|敏感词查询工具|新广告法|极限用语通用在线检测_微信公众号：K3达人社（ID:doinxx）</p>
            </div>
        </div>
    </div>
    <div id="fh5co-bottom-info">
        <div class="container">
            <div class="layui-tab">
                <!--<span class="layui-breadcrumb" lay-separator="  " style="visibility: visible;">
                    <span href="javascript:return false;">在线查词</span><span lay-separator="">  </span>
                    <a href="textcorrect.html">文本纠错</a><span lay-separator="">  </span>
                </span>-->
                <div class="layui-tab-content">
                    <div class="layui-tab-item layui-show">
                        <div class="line-big"></div>
                        <form id="formContent">
                            <div class="item hidden" id="wordTypeSelect" style="margin-top:10px;font-size:15px;">
                                <input type="checkbox" name="words_type" value="0" checked title="通用词库" id="chkTYC" class="word-type"><label for="chkTYC">通用词库</label>
                                <input type="checkbox" name="words_type" value="1" checked title="敏感词" id="chkMGC" class="word-type"><label for="chkMGC">敏感词</label>
                                <input type="checkbox" name="words_type" value="2" checked title="小红书词" id="chkXHS" class="word-type"><label for="chkXHS">小红书词</label>
                                <input type="checkbox" name="words_type" value="3" checked title="广告词" id="chkGGC" class="word-type"><label for="chkGGC">广告词</label>
                                <input type="checkbox" name="words_type" value="4" checked title="医疗词" id="chkYLC" class="word-type"><label for="chkYLC">医疗词</label>
                                <input type="checkbox" name="words_type" value="5" checked title="B站词" id="chkBZC" class="word-type"><label for="chkBZC">B站词</label>
                            </div>
                            <div class="show-list" style="padding-top:5px;">
                                <div class="line-big">
                                    <div class="xl12 xs4 xm6">
                                        <div class="item">
                                            <div class="words-container">
                                                <span style="">待查段落：</span>
                                                <div class="f-right" style="font-size:14px;margin-right:5px;"><input type="radio" name="checkMethod" checked class="word-type" title="通用查询" id="rdTY" /><label for="rdTY">广告通用检测</label><input type="radio" name="checkMethod" class="word-type" title="专用查询" id="rdZY" /><label for="rdZY">小红书专用检测</label></div>
                                            </div>
                                            <textarea class="form-control" id="content" name="content" required placeholder="请输入要查询违禁词的段落"></textarea>
                                            <input type="hidden" value="" name="hdCheckCode" id="hdCheckCode" />
                                            <button class="clear-content" id="btnClearContent"> 清空 </button>
                                        </div>
                                        <div class="line margin-top text-center"><a id="btnPaste" class="clear-text more-back border-main a-btn float-left" style="display:none;">粘贴</a> <a id="btnSumbit" class="more-back border-main a-btn">分析检测</a><a id="btnClear" class="clear-text more-back border-main a-btn">清除内容</a> <a id="btnCopy" class="clear-text more-back border-main a-btn f-right">一键复制</a></div>
                                    </div>
                                    <div class="xl12 xs4 xm6">
                                        <div class="item m-item">
                                            <div class="words-container">
                                                <span>分析结果：</span>
                                                <span id="use_num" class="pull-right num layui-hide-xs" style="color:#FF4E60;float:right;font-size:16px;margin-right:10px;"></span>
                                                <p class="pull-right layui-hide-xs" style="line-height:25px;color:#666;font-size:14px;float:right;">累计过滤文章篇数：</p>
                                            </div>
                                            <div class="card" style="height:255px;">
                                                <div class="srcoll-box form-control well" style="height:255px;" id="afterCheckText"></div>
                                            </div>
                                        </div>
                                        <div class="line margin-big-top" id="colorDesc"></div>
                                    </div>
                                </div>
                            </div>
                            <div style="height:20px;"></div>
                            <div class="line-big" id="showBannedWords">
                                <div class="xl12 xs4 xm12">
                                    <div class="item">
                                        <div class="card" style="padding:0px 20px 20px 20px">
                                            <div class="words-container">
                                                违禁词列表：
                                                <span style="float:right;font-size:14px;">
                                                    <span>全文共 <span id="wordsNum">0</span> 字</span>
                                                    <span style="margin-left:15px;">违禁词共 <span id="bannedNum">0</span> 个</span>
                                                </span>
                                            </div>
                                            <div class="bannedword-row" style="line-height:35px;color: #999999;">
                                                <div class="bannedword-col keyword-col">关键词</div>
                                                <div class="bannedword-col type-col">类型</div>
                                                <div class="bannedword-col count-col">状态</div>
                                            </div>
                                            <div class="srcoll-box" id="bannedDetail"></div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </form>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <div class="blankbig"></div>

    <script type="text/javascript" src="/static/js/bottom.js"></script>
    <script type="text/javascript" src="/static/js/layui/layui.js"></script>
    <script type="text/javascript">
        var words_type_options;

        $(function () {

            var kind = getUrlPara('kind');
            if (kind == 'zy') $('#rdZY').click();
            var action = getUrlPara('action');
            
            getCheckNum();
            get_words_type_options("ty")

            if (decodeURIComponent(location.search).indexOf('radio=小红书敏感词违禁检测') < 0) return;
            document.querySelectorAll('input[type="radio"]')[1].checked = true
            document.getElementById('wordTypeSelect').classList.remove('hidden')
        });
 
        const getCheckNum = function () {
            $.ajax({
                type: "GET",
                url: getUrl("get_check_article_number"),//"@Url.Action("CheckArticleNum", "Home")",//'/xhsSys/api/api.aspx?f=getCheckNum',
                data: {},
                success: function (res) {
                    $('.num').html(res.data);
                    $("#use_num").numberAnimate({ num: res.data, speed: 1800, symbol: "," });
                },
                dataType: 'json'
            });
        }
        function get_words_type_options(method) {
            $.ajax({
                type: 'GET',
                url: getUrl("get_banned_type", "typeId=" + method),// "/home/GetBannedType?typeId=" + method,
                dataType: 'json',
                success: function (ret, stutas, xhr) {
                    if (ret.errcode != 0) {
                        if (method == "ZY") {
                            words_type_options = [
                                { words_type_name: '通用词库', color: '#F8F8FF' },//幽灵白
                                { words_type_name: '敏感词', color: '#FF0000' },//红色
                                { words_type_name: '小红书词', color: '#FF8C00' },//深橙色
                                { words_type_name: '广告词', color: '#FF7F50' },//珊瑚
                                { words_type_name: '医疗词', color: '#BC8F8F' },//玫瑰棕色
                                { words_type_name: 'B站词', color: '#FFFF00' }//浅黄
                            ];
                        }
                        else {
                            words_type_options = [
                                { "words_type_name": "谩骂", "color": "#F8F8FF" }, //幽灵白
                                { "words_type_name": "违禁", "color": "#FF0000" }, //红色
                                { "words_type_name": "绝对化用语", "color": "#FF8C00" }, //深橙色
                                { "words_type_name": "其他敏感描述", "color": "#FF7F50" }, //珊瑚
                                { "words_type_name": "涉政", "color": "#BC8F8F" }, //玫瑰棕色
                                { "words_type_name": "色情", "color": "#FFFF00" }, //浅黄
                                { "words_type_name": "涉暴", "color": "#2aac22" }
                            ]
                        }
                    }
                    else words_type_options = ret.data;
                },
                error: function (xhr, textStatus, data) {
                    if (method == "ZY") {
                        words_type_options = [
                            { words_type_name: '通用词库', color: '#F8F8FF' },//幽灵白
                            { words_type_name: '敏感词', color: '#FF0000' },//红色
                            { words_type_name: '小红书词', color: '#FF8C00' },//深橙色
                            { words_type_name: '广告词', color: '#FF7F50' },//珊瑚
                            { words_type_name: '医疗词', color: '#BC8F8F' },//玫瑰棕色
                            { words_type_name: 'B站词', color: '#FFFF00' }//浅黄
                        ];
                    }
                    else {
                        words_type_options = [
                            { "words_type_name": "谩骂", "color": "#F8F8FF" }, //幽灵白
                            { "words_type_name": "违禁", "color": "#FF0000" }, //红色
                            { "words_type_name": "绝对化用语", "color": "#FF8C00" }, //深橙色
                            { "words_type_name": "其他敏感描述", "color": "#FF7F50" }, //珊瑚
                            { "words_type_name": "涉政", "color": "#BC8F8F" }, //玫瑰棕色
                            { "words_type_name": "色情", "color": "#FFFF00" }, //浅黄
                            { "words_type_name": "涉暴", "color": "#2aac22" }
                        ]
                    }
                }
            });
        }
        $("#rdZY").change(function () {
            if ($("#rdZY")[0].checked) {
                $("#wordTypeSelect").removeClass("hidden");
                get_words_type_options("ZY");
            }
        })
        $("#rdTY").change(function () {
            if ($("#rdTY")[0].checked) {
                $("#wordTypeSelect").removeClass("hidden").addClass("hidden");
                get_words_type_options("TY");
            }
        })
        $("#wordDetail").click(function () {
            layer.open({
                type: 1,
                area: ['700px', '550px'],
                offset: ['50px', '350px'],
                scrollbar: false,
                title: "违禁词列表",
                scrollbar: false,
                closeBtn: 0,
                fixed: false, //不固定
                maxmin: false,
                content: $("#showBannedWords").html(),
                btn: ["确定"]
            });
        })
        $("#btnClear").click(function () {
            $("#content").val('');
            $(".srcoll-box").html('');
            $("#wordsNum").text("0");
            $("#bannedNum").text("0");
            $("#colorDesc").html("");
        })
        $("#btnClearContent").click(function () {
            $("#content").val('');
        });
        
        function checkWordZY() {
            var wordtypeArr = [];
            $('input[name=words_type]:checked').each(function () {
                wordtypeArr.push($(this).val());
            });
            if (wordtypeArr.length == 0) { layer.alert('请至少选择一项违禁词类别！', { icon: 6 }); return false; }
            let text = $.trim($('#content').val());
            var index = layer.load(1, { shade: [0.1, '#fde5e5'] });//0.1透明度的白色背景
            $.ajax({
                type: 'POST',
                url: getUrl("check_words_zhuanyong"),
                data: { words_type: wordtypeArr, check_text: encodeURIComponent(text) },
                dataType: 'json',
                success: function (ret, stutas, xhr) {
                    layer.close(index);
                    if (ret.error != 0) { alert(ret.msg); return false; }
                    if (ret.data.length == 0) { alert("没有检测到违禁词！"); return false; }
                    var html = "";
                    var text = $("#content").val();
                    let _text = func_words_zy(ret, text);

                    $('#afterCheckText').html(_text);
                    getCheckNum();

                    $.each(words_type_options, function (index, item) {
                        var num = 0;
                        if (item.words_type == 0) num = ret.data.baidu_check.words.length;
                        else {
                            var words_type_num = $.grep(ret.data.local_check.words, function (name, ind) { return name.words_type == item.words_type });
                            if (words_type_num) num = words_type_num.length;
                        }
                        html += "<a style='background:" + item.color + ";color:#ffffff;margin:5px;padding:3px;'>" + item.words_type_name + "(" + num + ")</a>";
                    })
                    $("#colorDesc").html("<a>颜色说明：</a>" + html);
                    var content_len = $("#content").val().length;
                    $("#wordsNum").text(content_len);
                    $("#bannedNum").text(ret.data.baidu_check.words.length + ret.data.local_check.words.length);
                    html = "";
                    $.each(ret.data.baidu_check.words, function (index, item) {
                        var rowId = index + 1;
                        if (rowId % 2 == 0) {
                            html += "<div class='bannedword-col keyword-col' style='background:#d2f383;'>" + rowId + "-" + item.words + "</div>";
                            html += "<div class='bannedword-col type-col' style='background:#d2f383;'>通用词</div>";
                            html += "<div class='bannedword-col count-col' style='background:#d2f383;'>    /  </div>";
                        }
                        else {
                            html += "<div class='bannedword-col keyword-col'>" + rowId + "-" + item.words + "</div>";
                            html += "<div class='bannedword-col type-col'>通用词</div>";
                            html += "<div class='bannedword-col count-col'>    /  </div>";
                        }
                    })
                    var n = ret.data.baidu_check.words.length;
                    $.each(ret.data.local_check.words, function (index, item) {
                        var rowId = index + n + 1;
                        if (rowId % 2 == 0) {
                            html += "<div class='bannedword-col keyword-col' style='background:#d2f383;'>" + rowId + "-" + item.words + "</div>";
                            html += "<div class='bannedword-col type-col' style='background:#d2f383;'>" + item.words_type_name + "</div>";
                            html += "<div class='bannedword-col count-col' style='background:#d2f383;'>    /  </div>";
                        }
                        else {
                            html += "<div class='bannedword-col keyword-col'>" + rowId + "-" + item.words + "</div>";
                            html += "<div class='bannedword-col type-col'>" + item.words_type_name + "</div>";
                            html += "<div class='bannedword-col count-col'>  /  </div>";
                        }
                    });
                    $("#bannedDetail").html(html);
                },
                error: function (xhr, textStatus, data) {
                    layer.close(index);
                    layer.alert(data, { icon: 6 });
                }
            })
        }
        function checkWord() {
            var index = layer.load(1, { shade: [0.1, '#fde5e5'] });//0.1透明度的白色背景
            let text = $.trim($("content").val());
            $.ajax({
                type: 'POST',
                url: getUrl("check_words_tongyong"),//'@Url.Action("CheckWords", "Home")',
                data: $("#formContent").serialize(),
                dataType: 'json',
                success: function (ret, stutas, xhr) {
                    layer.close(index);
                    if (ret.errcode != 0) { layer.alert(ret.errmsg, { icon: 6 }); return false; }
                    if (ret.data.length == 0) { layer.alert("没有检测到违禁词！", { icon: 6 }); return false; }
                    var html = "";
                    used_words_type_options = [];
                    var text = $("#content").val();
                    let _text = func_words(ret, text);

                    $('#afterCheckText').html(_text);
                    getCheckNum();

                    $.each(used_words_type_options, function (index, item) {
                        var words_type_num = $.grep(ret.data, function (name, ind) { return name.desc == item.words_type_name });
                        var num = 0;
                        if (words_type_num) num = words_type_num.length;
                        html += "<a style='background:" + item.color + ";color:#ffffff;margin:5px;padding:3px;'>" + item.words_type_name + "(" + num + ")</a>";
                    })
                    $("#colorDesc").html("<a>颜色说明：</a>" + html);
                    var content_len = $("#content").val().length;
                    $("#wordsNum").text(content_len);
                    $("#bannedNum").text(ret.data.length);
                    html = "";
                    $.each(ret.data, function (index, item) {
                        var rowId = index + 1;
                        if (rowId % 2 == 0) {
                            html += "<div class='bannedword-col keyword-col' style='background:#d2f383;'>" + rowId + "-" + item.keyword + "</div>";
                            html += "<div class='bannedword-col type-col' style='background:#d2f383;'>" + item.desc + "</div>";
                            html += "<div class='bannedword-col count-col' style='background:#d2f383;'>" + item.issure + "</div>";
                        }
                        else {
                            html += "<div class='bannedword-col keyword-col'>" + rowId + "-" + item.keyword + "</div>";
                            html += "<div class='bannedword-col type-col'>" + item.desc + "</div>";
                            html += "<div class='bannedword-col count-col'>" + item.issure + "</div>";
                        }
                    });
                    $("#bannedDetail").html(html);
                },
                error: function (xhr, textStatus, data) {
                    layer.close(index);
                    layer.alert(data, { icon: 6 });
                }
            })
        }
        const func_words_zy = function (res, text) {
            let use_words = [];
            baidu_words_count = 0;
            local_words_count = 0;
            if (res.error === 1) { layer.msg(res.msg); return false; }
            let data = res.data;
            if (data.baidu_check.is_pass === 0) {
                if (data.baidu_check.words.length > 0) {
                    data.baidu_check.words.sort(function (a, b) {
                        return b.length - a.length;
                    });
                    for (let i in data.baidu_check.words) {
                        let words = {};
                        words.words = data.baidu_check.words[i];
                        words.words_type = 0;
                        words.words_type_name = '通用词库';
                        data.local_check.words.push(words);
                    }
                }
            }
            if (data.local_check.words.length > 0) {
                data.local_check.words.sort(function (a, b) { return b.words.length - a.words.length; });
                for (let i in data.local_check.words) {
                    if (func_check_use_words_zy(use_words, data.local_check.words[i].words)) {
                        let res;
                        if (data.local_check.words[i].words_type > 0) {
                            res = article_add_color_zy(data.local_check.words[i].words, words_type_options[data.local_check.words[i].words_type].color, text, 1);
                        } else {
                            res = article_add_color_zy(data.local_check.words[i].words, words_type_options[data.local_check.words[i].words_type].color, text, 0);
                        }
                        if (res !== false) {
                            text = res
                            use_words.push(data.local_check.words[i].words)
                        }
                    }
                }
            }
            return text;
        }
        const func_check_use_words_zy = function (use_words, words) {
            let str;
            for (let i in use_words) {
                str = use_words[i].indexOf(words);
                if (str !== -1) {
                    return false
                }
            }
            return true;
        }
        const article_add_color_zy = function (words_name, color, article, type) {
            let str = (article.split(words_name)).length - 1; //article.indexOf(words_name);
            if (str !== -1) {
                let words_name1 = words_name.replace(new RegExp("\\?", 'g'), "\\\?");
                words_name1 = words_name1.replace(new RegExp("\\+", 'g'), "\\\+");
                const reg = new RegExp(words_name1, 'g');
                article = article.replace(reg, '<font style="background-color:' + color + ';color:white;">' + words_name + '</font>');
                if (type === 0) {
                    baidu_words_count = baidu_words_count + words_name.length * str
                } else {
                    local_words_count = local_words_count + words_name.length * str
                }
                return article;
            } else {
                return false
            }
        }

        const func_words = function (res, text) {
            let use_words = [];

            let data = res.data;
            if (data.length > 0) {
                data.sort(function (a, b) { return b.keyword.length - a.keyword.length; });
                for (let i in data) {
                    if (func_check_use_words(use_words, data[i].keyword)) {
                        let res = article_add_color(data[i].keyword, func_check_color(data[i]), text);
                        if (res !== false) {
                            text = res
                            use_words.push(data[i].keyword)
                        }
                    }
                }
            }
            return text;
        }
        var used_words_type_options = [];
        function func_check_color(data_item) {
            var words_type = $.grep(words_type_options, function (n, i) { return n.words_type_name == data_item.desc });
            if (words_type.length == 0) {
                var notExist_color = "#1a0669";
                var new_data = { "words_type_name": data_item.desc, "color": notExist_color };
                words_type_options.push(new_data)
                var existWordsType = $.grep(used_words_type_options, function (item, index) { return item.words_type_name == new_data.words_type_name });
                if (existWordsType.length == 0) used_words_type_options.push(new_data);
                $.post(getUrl("new_words_type"), data_item, function (ret) { return notExist_color; });
            }
            else {
                var existWordsType = $.grep(used_words_type_options, function (item, index) { return item.words_type_name == words_type[0].words_type_name });
                if (existWordsType.length == 0) used_words_type_options.push(words_type[0]);
                return words_type[0].color;
            }
        }
        const func_check_use_words = function (use_words, words) {
            let str;
            for (let i in use_words) {
                str = use_words[i].indexOf(words);
                if (str !== -1) {
                    return false
                }
            }
            return true;
        }
        $('#btnSumbit').click(function () {
            var txt = $("#content").val();
            if ($.trim(txt) == "") { layer.alert('请先输入待检测的文本！', { icon: 6 }); return false; }
            if ($("#rdTY")[0].checked) checkWord();
            else if ($("#rdZY")[0].checked) checkWordZY()
        });
        $("#btnCopy").click(function () {
            const text = $('#content').val();
            var dummy = document.createElement("textarea");
            let newContent = document.createTextNode(text);
            dummy.appendChild(newContent);
            document.body.appendChild(dummy);
            dummy.select();
            document.execCommand('copy');
            document.body.removeChild(dummy);
            layer.alert("复制成功！", { icon: 6 });
        })
        $("#btnPaste").click(function () {
            var dummy = document.getElementById('content')
            dummy.focus();
            var ret = document.execCommand('paste');
            if (!ret) { layer.alert("当前浏览器不支持本功能！", { icon: 6 }); }
        })
        //$(function () {
        //    document.addEventListener('paste', function (e) { pasteEvent(e); });
        //});
    </script>

</body>
</html>